package com.lcj.ssm.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.lcj.ssm.po.Reply;
import com.lcj.ssm.po.ReplyCustom;
import com.lcj.ssm.po.ReplyVO;
import com.lcj.ssm.mapper.ReplyMapper;
import com.lcj.ssm.po.PageMessage;
import com.lcj.ssm.service.ReplyService;
import com.lcj.ssm.po.RoleVO;

public class ReplyServiceImpl implements ReplyService{

	@Autowired
	private ReplyMapper replyMapper;

	public int insertReply(Reply reply) throws Exception {
		if(reply!=null){
			return replyMapper.insert(reply);
		}else{
			return 0;	
		}
	}


	public int deleteReply(int id) throws Exception {
		if(id>0){
			return replyMapper.deleteByPrimaryKey(id);
		}else{
			return 0;
		}
	}

	public int updateReply(Reply reply) throws Exception {
		if(reply!=null && reply.getId()!=null){
			return replyMapper.updateByPrimaryKeySelective(reply);
		}else{
			return 0;
		}
	}

	public List<ReplyCustom> selectReplyList(ReplyVO replyvo) throws Exception {
		if(replyvo !=null){
			return replyMapper.selectReplyList(replyvo);
		}else{
			return null;
		}
	}

	public Reply selectReply(int id) throws Exception {
		if(id>0){
			return replyMapper.selectByPrimaryKey(id);
		}else{
			return null;
		}
	}


	public int getTotalCount() throws Exception {
		return replyMapper.selectTotalCount();
	}

	public int getTotalCountByTopic(Integer topicid) throws Exception {
		return replyMapper.selectTotalCountByTopic(topicid);
	}

}
